//
//  UIBarButtonItem+Extension.swift
//  MLSMircoBlog
//
//  Created by 袁航 on 15/8/5.
//  Copyright © 2015年 yuanhang. All rights reserved.
//

import UIKit
extension UIBarButtonItem {
    convenience init(nomalImageName: String?, highLightedImageName: String, target: AnyObject?, action: String?) {
        
        let button = UIButton(nomarlImageName: nomalImageName, highlightImageName: highLightedImageName)
        // 如果有监听方法,就监听
        if let actionStr = action {
            button.addTarget(target, action: Selector(actionStr), forControlEvents: UIControlEvents.TouchUpInside)
        }
        // 实例化
        self.init(customView: button)
    }
}